<?php
class Auth{
	var $_name,$_no,$_role,$_department;
	public function getname()
    {
    	$info=M("info");
    	if(Cookie::get('no')&&$info->find(Cookie::get('no')))
    		return $info->name;
    	else
    		return "";
    }
    
	public function getno()
    {
    	$info=M("info");
    	if(Cookie::get('no'))
    		return Cookie::get('no');
    	else
    		return "";
    }
    
	public function getrole()
    {
    	$info=M("info");
    	if(Cookie::get('no')&&$info->find(Cookie::get('no')))
    		return $info->role;
    	else
    		return "访客";
    }
    
	public function getdepartment()
    {
    	$info=M("info");
    	if(Cookie::get('no')&&$info->find(Cookie::get('no')))
    		return $info->departmentid;
    	else
    		return "";
    }
	public function getdepartmentname()
    {
    	$department=M("department");
    	if(Auth::getdepartment()&&$department->find(Auth::getdepartment()))
    		return $department->name;
    	else
    		return "";
    }
}